//
//  HttpResponse.h
//  HttpNetWork
//
//  Created by admin on 2019/4/19.
//  Copyright © 2019年 admin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "APIError.h"

NS_ASSUME_NONNULL_BEGIN


@interface HttpResponse:NSObject

/// 状态码
@property(nonatomic,assign) NSInteger code;

/// 错误信息
@property(nonatomic,copy) NSString* _Nullable message;

///模型数据
@property(nonatomic,strong)id _Nullable data;

///系统时间戳
@property(nonatomic,assign) NSInteger ts;

///
@property(nonatomic,copy)NSString* _Nullable sid;

///分页列表的总数
@property(nonatomic,assign) NSInteger total;

///当前页
@property(nonatomic,assign) NSInteger currentPage;

///总页数
@property(nonatomic,assign) NSInteger pages;


///请求是否成功
@property(nonatomic,assign)BOOL isOK;

///json数据
@property(nonatomic,strong)id _Nullable jsondata;

///json字符串
@property(nonatomic,strong)NSString* _Nullable jsonString;

///错误信息
@property(nonatomic,strong)APIError * _Nullable  error;




///成功
- (HttpResponse*)success:(void (^)(id data))success;

///失败
- (HttpResponse*)failure:(void (^)(APIError* error))failure;

///默认失败提示
- (HttpResponse*)failureDefalut;


@end

NS_ASSUME_NONNULL_END
